package com.example.springbootdatamock.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;


@Configuration
public class RedisConfig {
    @Autowired
    private RedisTemplate redisTemplate;

    @Bean
    public RedisTemplate redisTemplateInit() {
        this.redisTemplate.setKeySerializer((RedisSerializer) new StringRedisSerializer());
        this.redisTemplate.setHashKeySerializer((RedisSerializer) new StringRedisSerializer());
        this.redisTemplate.setHashValueSerializer((RedisSerializer) new StringRedisSerializer());
        this.redisTemplate.setValueSerializer((RedisSerializer) new StringRedisSerializer());
        return this.redisTemplate;
    }
}



 